{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 银行间同业拆放利率\n",
    "\n",
    "Shibor接口是获取上海银行间同业拆放利率（Shanghai Interbank Offered Rate，简称Shibor）的便捷接口，以年为参数获取，可以取到公布的Shibor品种包括隔夜、1周、2周、1个月、3个月、6个月、9个月及1年的周期数据。目前主要包括以下类别：\n",
    "\n",
    "    Shibor拆放利率\n",
    "    银行报价数据\n",
    "    Shibor均值数据\n",
    "    贷款基础利率（LPR）\n",
    "    LPR均值数据\n",
    "\n",
    "Shibor拆放利率\n",
    "\n",
    "获取银行间同业拆放利率数据，目前只提供2006年以来的数据。\n",
    "\n",
    "参数说明：\n",
    "\n",
    "    year:年份(YYYY),默认为当前年份\n",
    "\n",
    "返回值说明：\n",
    "\n",
    "    date:日期\n",
    "    ON:隔夜拆放利率\n",
    "    1W:1周拆放利率\n",
    "    2W:2周拆放利率\n",
    "    1M:1个月拆放利率\n",
    "    3M:3个月拆放利率\n",
    "    6M:6个月拆放利率\n",
    "    9M:9个月拆放利率\n",
    "    1Y:1年拆放利率\n",
    "\n",
    "调用方法：\n",
    "```\n",
    "import tushare as ts\n",
    "df = ts.shibor_data() #取当前年份的数据\n",
    "#df = ts.shibor_data(2014) #取2014年的数据\n",
    "df.sort('date', ascending=False).head(10)\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "import tushare as ts\n",
    "df = ts.shibor_data() #取当前年份的数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#df = ts.shibor_data(2018) #取2014年的数据\n",
    "df.sort('date', ascending=False).head(10)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 银行报价数据\n",
    "\n",
    "获取银行间报价数据，目前只提供2006年以来的数据。\n",
    "\n",
    "参数说明：\n",
    "\n",
    "    year:年份(YYYY),默认为当前年份\n",
    "\n",
    "返回值说明：\n",
    "\n",
    "    date:日期\n",
    "    bank:报价银行名称\n",
    "    ON:隔夜拆放利率\n",
    "    ON_B:隔夜拆放买入价\n",
    "    ON_A:隔夜拆放卖出价\n",
    "    1W_B:1周买入\n",
    "    1W_A:1周卖出\n",
    "    2W_B:买入\n",
    "    2W_A:卖出\n",
    "    1M_B:买入\n",
    "    1M_A:卖出\n",
    "    3M_B:买入\n",
    "    3M_A:卖出\n",
    "    6M_B:买入\n",
    "    6M_A:卖出\n",
    "    9M_B:买入\n",
    "    9M_A:卖出\n",
    "    1Y_B:买入\n",
    "    1Y_A:卖出\n",
    "\n",
    "调用方法：\n",
    "```\n",
    "import tushare as ts\n",
    "df = ts.shibor_quote_data() #取当前年份的数据\n",
    "#df = ts.shibor_quote_data(2014) #取2014年的数据\n",
    "df.sort('date', ascending=False).head(10)\n",
    "```\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "import tushare as ts\n",
    "df = ts.shibor_quote_data(2017) #取当前年份的数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Shibor均值数据\n",
    "\n",
    "获取Shibor均值数据，目前只提供2006年以来的数据。\n",
    "\n",
    "参数说明：\n",
    "\n",
    "    year:年份(YYYY),默认为当前年份\n",
    "\n",
    "返回值说明：\n",
    "\n",
    "    date:日期\n",
    "    其它分别为各周期5、10、20均价，请参考上面的周期含义\n",
    "\n",
    "调用方法：\n",
    "```\n",
    "import tushare as ts\n",
    "df = ts.shibor_ma_data() #取当前年份的数据\n",
    "#df = ts.shibor_ma_data(2014) #取2014年的数据\n",
    "df.sort('date', ascending=False).head(10)\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 贷款基础利率（LPR）\n",
    "\n",
    "获取贷款基础利率（LPR）数据，目前只提供2013年以来的数据。\n",
    "\n",
    "参数说明：\n",
    "\n",
    "    year:年份(YYYY),默认为当前年份\n",
    "\n",
    "返回值说明：\n",
    "\n",
    "    date:日期\n",
    "    1Y:1年贷款基础利率\n",
    "\n",
    "调用方法：\n",
    "```\n",
    "import tushare as ts\n",
    "df = ts.lpr_data() #取当前年份的数据\n",
    "#df = ts.lpr_data(2014) #取2014年的数据\n",
    "df.sort('date', ascending=False).head(10)\n",
    "```\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# LPR均值数据\n",
    "\n",
    "获取贷款基础利率均值数据，目前只提供2013年以来的数据。\n",
    "\n",
    "参数说明：\n",
    "\n",
    "    year:年份(YYYY),默认为当前年份\n",
    "\n",
    "返回值说明：\n",
    "\n",
    "    date:日期\n",
    "    1Y_5:5日均值\n",
    "    1Y_10:10日均值\n",
    "    1Y_20:20日均值\n",
    "\n",
    "调用方法：\n",
    "```\n",
    "import tushare as ts\n",
    "df = ts.lpr_ma_data() #取当前年份的数据\n",
    "#df = ts.lpr_ma_data(2014) #取2014年的数据\n",
    "df.sort('date', ascending=False).head(10)\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "import tushare as ts\n",
    "df = ts.lpr_ma_data() #取当前年份的数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "df"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
